
#ifndef _DPD_SPI_H_
#define _DPD_SPI_H_

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

#include "esp_system.h"
#include "driver/spi_master.h"
#include "driver/gpio.h"

#define PARALLEL_LINES 16

#define EPD_HOST SPI2_HOST

#define PIN_NUM_MOSI 35
#define PIN_NUM_CLK 36
#define EPD_CS_PIN 45

#define EPD_DC_PIN 4
#define EPD_RST_PIN 5
#define EPD_BUSY_PIN 6

#define epd_gpio_write(_pin, _value) gpio_set_level(_pin, _value)
#define epd_gpio_read(_pin) gpio_get_level(_pin)

#define epd_delay_ms(__xms) vTaskDelay(__xms / portTICK_PERIOD_MS)

int epd_gpio_init(void);
int epd_spi_init(void);
void epd_spi_write_byte(uint8_t value);
int epd_module_init(void);
void epd_module_exit(void);

#endif
